package com.falcon.util;

import org.apache.maven.project.MavenProject;

import java.io.File;

/**
 * @author zongf
 * @date 2023-12-19
 **/
public class PathUtil {

    public static final String JAVA_SOURCE_DIR = File.separator + "src" + File.separator + "main" + File.separator + "java";
    public static final String RESOURCES_DIR = File.separator + "src" + File.separator + "main" + File.separator + "resources";
    public static final String TEST_JAVA_SOURCE_DIR = File.separator + "src" + File.separator + "test" + File.separator + "java";
    public static final String TEST_RESOURCES_DIR = File.separator + "src" + File.separator + "test" + File.separator + "resources";
    public static final String TARGET_DIR =  File.separator + "target";


    public static String getTargetDir(MavenProject project) {
        return project.getBasedir().getAbsolutePath() + TARGET_DIR;
    }

    public static String getPomPath(MavenProject project) {
        return project.getBasedir().getAbsolutePath() + File.separator + "pom.xml";
    }

    public static String getBackPomPath(MavenProject project) {
        return project.getBasedir().getAbsolutePath() + File.separator + "pom-bk.xml";
    }

    public static String getSubPomPath(String directory) {
        return directory + File.separator + "pom.xml";
    }

    public static String getJavaSourceDir(String modulePath) {
        return modulePath + JAVA_SOURCE_DIR;
    }
    public static String getResourcesDir(String modulePath) {
        return modulePath + RESOURCES_DIR;
    }

    public static String getTestJavaSourceDir(String modulePath) {
        return modulePath + TEST_JAVA_SOURCE_DIR;
    }

    public static String getTestResourcesDir(String modulePath) {
        return modulePath + TEST_RESOURCES_DIR;
    }


}
